<template>
    <view class="page-box">
        <header class="header"></header>
        <section class="section" style="margin-top: -494rpx;">
            <!-- 车辆证件 -->
            <view class="form-box" style="margin-bottom: 16rpx;">
                <view class="form-title">车辆证件</view>
                <view class="form-item">
                    <!-- 登记证 -->
                    <template v-if="checkingSupplyInfo.car_registration">
                        <view class="title" style="margin-bottom: 7rpx;">机动车登记证书（抵押前）：</view>
                        <view class="tip row verCenter" style="margin-bottom: 16rpx;"><text class="iconfont icon-a-tubiaochangyongsousuo17"></text><text class="t1">车辆登记证书请拍至登记证书空白页</text></view>
                        <view class="upload-list">
                            <view class="box column rowCenter verCenter">
                                <view class="area column rowCenter verCenter" @click="chooseImageChange('car_registration_1')">
                                    <template v-if="isVideo(form.car_registration_1)">
                                        <video :src="form.car_registration_1" object-fit="cover"></video>
                                    </template>
                                    <template v-else-if="isImage(form.car_registration_1)">
                                        <image :src="form.car_registration_1" mode="aspectFill"></image>
                                    </template>
                                    <template v-else-if="isPdf(form.car_registration_1)">
                                        <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                    </template>
                                    <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_registration_1')" v-if="form.car_registration_1">
                                        <text class="iconfont icon-shanchu"></text>
                                    </view>
                                </view>
                                <view class="text">第1、2页</view>
                            </view>
                            <view class="box column rowCenter verCenter">
                                <view class="area column rowCenter verCenter" @click="chooseImageChange('car_registration_2')">
                                    <template v-if="isVideo(form.car_registration_2)">
                                        <video :src="form.car_registration_2" object-fit="cover"></video>
                                    </template>
                                    <template v-else-if="isImage(form.car_registration_2)">
                                        <image :src="form.car_registration_2" mode="aspectFill"></image>
                                    </template>
                                    <template v-else-if="isPdf(form.car_registration_2)">
                                        <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                    </template>
                                    <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_registration_2')" v-if="form.car_registration_2">
                                        <text class="iconfont icon-shanchu"></text>
                                    </view>
                                </view>
                                <view class="text">第3、4页</view>
                            </view>
                            <view class="box column rowCenter verCenter">
                                <view class="area column rowCenter verCenter" @click="chooseImageChange('car_registration_3')">
                                    <template v-if="isVideo(form.car_registration_3)">
                                        <video :src="form.car_registration_3" object-fit="cover"></video>
                                    </template>
                                    <template v-else-if="isImage(form.car_registration_3)">
                                        <image :src="form.car_registration_3" mode="aspectFill"></image>
                                    </template>
                                    <template v-else-if="isPdf(form.car_registration_3)">
                                        <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                    </template>
                                    <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_registration_3')" v-if="form.car_registration_3">
                                        <text class="iconfont icon-shanchu"></text>
                                    </view>
                                </view>
                                <view class="text">第5、6页(选填)</view>
                            </view>
                            <view class="box column rowCenter verCenter">
                                <view class="area column rowCenter verCenter" @click="chooseImageChange('car_registration_4')">
                                    <template v-if="isVideo(form.car_registration_4)">
                                        <video :src="form.car_registration_4" object-fit="cover"></video>
                                    </template>
                                    <template v-else-if="isImage(form.car_registration_4)">
                                        <image :src="form.car_registration_4" mode="aspectFill"></image>
                                    </template>
                                    <template v-else-if="isPdf(form.car_registration_4)">
                                        <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                    </template>
                                    <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_registration_4')" v-if="form.car_registration_4">
                                        <text class="iconfont icon-shanchu"></text>
                                    </view>
                                </view>
                                <view class="text">第7、8页(选填)</view>
                            </view>
                        </view>
                    </template>
                    <!-- 驾驶证 -->
                    <template v-if="checkingSupplyInfo.car_driver_license_two || checkingSupplyInfo.car_driver_license_four">
                        <view class="title" style="margin-top: 28rpx;">驾驶证：</view>
                        <view class="upload-list">
                            <!-- 驾驶证四张图片 -->
                            <template v-if="checkingSupplyInfo.car_driver_license_four">
                                <view class="box column rowCenter verCenter">
                                    <view class="area column rowCenter verCenter" @click="chooseImageChange('car_driver_license_1')">
                                        <template v-if="isVideo(form.car_driver_license_1)">
                                            <video :src="form.car_driver_license_1" object-fit="cover"></video>
                                        </template>
                                        <template v-else-if="isImage(form.car_driver_license_1)">
                                            <image :src="form.car_driver_license_1" mode="aspectFill"></image>
                                        </template>
                                        <template v-else-if="isPdf(form.car_driver_license_1)">
                                            <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                        </template>
                                        <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_driver_license_1')" v-if="form.car_driver_license_1">
                                            <text class="iconfont icon-shanchu"></text>
                                        </view>
                                    </view>
                                </view>
                                <view class="box column rowCenter verCenter">
                                    <view class="area column rowCenter verCenter" @click="chooseImageChange('car_driver_license_2')">
                                        <template v-if="isVideo(form.car_driver_license_2)">
                                            <video :src="form.car_driver_license_2" object-fit="cover"></video>
                                        </template>
                                        <template v-else-if="isImage(form.car_driver_license_2)">
                                            <image :src="form.car_driver_license_2" mode="aspectFill"></image>
                                        </template>
                                        <template v-else-if="isPdf(form.car_driver_license_2)">
                                            <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                        </template>
                                        <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_driver_license_2')" v-if="form.car_driver_license_2">
                                            <text class="iconfont icon-shanchu"></text>
                                        </view>
                                    </view>
                                </view>
                                <view class="box column rowCenter verCenter">
                                    <view class="area column rowCenter verCenter" @click="chooseImageChange('car_driver_license_3')">
                                        <template v-if="isVideo(form.car_driver_license_3)">
                                            <video :src="form.car_driver_license_3" object-fit="cover"></video>
                                        </template>
                                        <template v-else-if="isImage(form.car_driver_license_3)">
                                            <image :src="form.car_driver_license_3" mode="aspectFill"></image>
                                        </template>
                                        <template v-else-if="isPdf(form.car_driver_license_3)">
                                            <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                        </template>
                                        <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_driver_license_3')" v-if="form.car_driver_license_3">
                                            <text class="iconfont icon-shanchu"></text>
                                        </view>
                                    </view>
                                </view>
                                <view class="box column rowCenter verCenter">
                                    <view class="area column rowCenter verCenter" @click="chooseImageChange('car_driver_license_4')">
                                        <template v-if="isVideo(form.car_driver_license_4)">
                                            <video :src="form.car_driver_license_4" object-fit="cover"></video>
                                        </template>
                                        <template v-else-if="isImage(form.car_driver_license_4)">
                                            <image :src="form.car_driver_license_4" mode="aspectFill"></image>
                                        </template>
                                        <template v-else-if="isPdf(form.car_driver_license_4)">
                                            <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                        </template>
                                        <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_driver_license_4')" v-if="form.car_driver_license_4">
                                            <text class="iconfont icon-shanchu"></text>
                                        </view>
                                    </view>
                                </view>
                            </template>
                            <!-- 驾驶证两张图片 -->
                            <template v-else-if="checkingSupplyInfo.car_driver_license_two">
                                <view class="box column rowCenter verCenter">
                                    <view class="area column rowCenter verCenter" @click="chooseImageChange('car_driver_license_1')">
                                        <template v-if="isVideo(form.car_driver_license_1)">
                                            <video :src="form.car_driver_license_1" object-fit="cover"></video>
                                        </template>
                                        <template v-else-if="isImage(form.car_driver_license_1)">
                                            <image :src="form.car_driver_license_1" mode="aspectFill"></image>
                                        </template>
                                        <template v-else-if="isPdf(form.car_driver_license_1)">
                                            <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                        </template>
                                        <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_driver_license_1')" v-if="form.car_driver_license_1">
                                            <text class="iconfont icon-shanchu"></text>
                                        </view>
                                    </view>
                                </view>
                                <view class="box column rowCenter verCenter">
                                    <view class="area column rowCenter verCenter" @click="chooseImageChange('car_driver_license_2')">
                                        <template v-if="isVideo(form.car_driver_license_2)">
                                            <video :src="form.car_driver_license_2" object-fit="cover"></video>
                                        </template>
                                        <template v-else-if="isImage(form.car_driver_license_2)">
                                            <image :src="form.car_driver_license_2" mode="aspectFill"></image>
                                        </template>
                                        <template v-else-if="isPdf(form.car_driver_license_2)">
                                            <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                        </template>
                                        <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_driver_license_2')" v-if="form.car_driver_license_2">
                                            <text class="iconfont icon-shanchu"></text>
                                        </view>
                                    </view>
                                </view>
                            </template>
                        </view>
                    </template>
                </view>
            </view>
            <!-- 车辆保险 -->
            <view class="form-box" style="margin-bottom: 16rpx;" v-if="checkingSupplyInfo.car_commercial_insurance_img || checkingSupplyInfo.car_compulsory_traffic_insurance_img">
                <view class="form-title">车辆保险</view>
                <view class="form-item">
                    <view class="upload-list">
                        <view class="box" v-if="checkingSupplyInfo.car_commercial_insurance_img">
                            <view class="title">商业险：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_commercial_insurance_img')">
                                <template v-if="isVideo(form.car_commercial_insurance_img)">
                                    <video :src="form.car_commercial_insurance_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_commercial_insurance_img)">
                                    <image :src="form.car_commercial_insurance_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_commercial_insurance_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_commercial_insurance_img')" v-if="form.car_commercial_insurance_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_compulsory_traffic_insurance_img">
                            <view class="title">交强险：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_compulsory_traffic_insurance_img')">
                                <template v-if="isVideo(form.car_compulsory_traffic_insurance_img)">
                                    <video :src="form.car_compulsory_traffic_insurance_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_compulsory_traffic_insurance_img)">
                                    <image :src="form.car_compulsory_traffic_insurance_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_compulsory_traffic_insurance_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_compulsory_traffic_insurance_img')" v-if="form.car_compulsory_traffic_insurance_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
            <!-- 12123截图 -->
            <view class="form-box" style="margin-bottom: 16rpx;" v-if="checkingSupplyInfo.car_violation_record_img || checkingSupplyInfo.car_annual_inspection_img || checkingSupplyInfo.car_elec_driver_license_img || checkingSupplyInfo.car_status_img || checkingSupplyInfo.car_driving_score_img || checkingSupplyInfo.car_displacement_img">
                <view class="form-title">12123截图</view>
                <view class="form-item">
                    <view class="upload-list">
                        <view class="box" v-if="checkingSupplyInfo.car_violation_record_img">
                            <view class="title">违章截图：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_violation_record_img')">
                                <template v-if="isVideo(form.car_violation_record_img)">
                                    <video :src="form.car_violation_record_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_violation_record_img)">
                                    <image :src="form.car_violation_record_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_violation_record_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_violation_record_img')" v-if="form.car_violation_record_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_annual_inspection_img">
                            <view class="title">年检截图：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_annual_inspection_img')">
                                <template v-if="isVideo(form.car_annual_inspection_img)">
                                    <video :src="form.car_annual_inspection_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_annual_inspection_img)">
                                    <image :src="form.car_annual_inspection_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_annual_inspection_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_annual_inspection_img')" v-if="form.car_annual_inspection_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_elec_driver_license_img">
                            <view class="title">电子驾驶证：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_elec_driver_license_img')">
                                <template v-if="isVideo(form.car_elec_driver_license_img)">
                                    <video :src="form.car_elec_driver_license_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_elec_driver_license_img)">
                                    <image :src="form.car_elec_driver_license_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_elec_driver_license_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_elec_driver_license_img')" v-if="form.car_elec_driver_license_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_status_img">
                            <view class="title">车辆状态截图：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_status_img')">
                                <template v-if="isVideo(form.car_status_img)">
                                    <video :src="form.car_status_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_status_img)">
                                    <image :src="form.car_status_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_status_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_status_img')" v-if="form.car_status_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_driving_score_img">
                            <view class="title">驾驶分查询：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_driving_score_img')">
                                <template v-if="isVideo(form.car_driving_score_img)">
                                    <video :src="form.car_driving_score_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_driving_score_img)">
                                    <image :src="form.car_driving_score_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_driving_score_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_driving_score_img')" v-if="form.car_driving_score_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_displacement_img">
                            <view class="title">车辆排量：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_displacement_img')">
                                <template v-if="isVideo(form.car_displacement_img)">
                                    <video :src="form.car_displacement_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_displacement_img)">
                                    <image :src="form.car_displacement_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_displacement_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_displacement_img')" v-if="form.car_displacement_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
            <!-- 车辆照片 -->
            <view class="form-box">
                <view class="form-title">车辆照片</view>
                <view class="form-item">
                    <view class="upload-list">
                        <view class="box" v-if="checkingSupplyInfo.car_front_img">
                            <view class="title">正前方：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_front_img')">
                                <template v-if="isVideo(form.car_front_img)">
                                    <video :src="form.car_front_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_front_img)">
                                    <image :src="form.car_front_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_front_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_front_img')" v-if="form.car_front_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_rear_img">
                            <view class="title">正后方：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_rear_img')">
                                <template v-if="isVideo(form.car_rear_img)">
                                    <video :src="form.car_rear_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_rear_img)">
                                    <image :src="form.car_rear_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_rear_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_rear_img')" v-if="form.car_rear_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_left_front_img">
                            <view class="title">左前方45°：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_left_front_img')">
                                <template v-if="isVideo(form.car_left_front_img)">
                                    <video :src="form.car_left_front_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_left_front_img)">
                                    <image :src="form.car_left_front_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_left_front_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_left_front_img')" v-if="form.car_left_front_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_right_front_img">
                            <view class="title">右前方：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_right_front_img')">
                                <template v-if="isVideo(form.car_right_front_img)">
                                    <video :src="form.car_right_front_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_right_front_img)">
                                    <image :src="form.car_right_front_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_right_front_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_right_front_img')" v-if="form.car_right_front_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_left_rear_img">
                            <view class="title">左后方：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_left_rear_img')">
                                <template v-if="isVideo(form.car_left_rear_img)">
                                    <video :src="form.car_left_rear_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_left_rear_img)">
                                    <image :src="form.car_left_rear_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_left_rear_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_left_rear_img')" v-if="form.car_left_rear_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_right_rear_img">
                            <view class="title">右后方：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_right_rear_img')">
                                <template v-if="isVideo(form.car_right_rear_img)">
                                    <video :src="form.car_right_rear_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_right_rear_img)">
                                    <image :src="form.car_right_rear_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_right_rear_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_right_rear_img')" v-if="form.car_right_rear_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_kilometers_img">
                            <view class="title">公里数：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_kilometers_img')">
                                <template v-if="isVideo(form.car_kilometers_img)">
                                    <video :src="form.car_kilometers_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_kilometers_img)">
                                    <image :src="form.car_kilometers_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_kilometers_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_kilometers_img')" v-if="form.car_kilometers_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_engine_img">
                            <view class="title">发动机：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_engine_img')">
                                <template v-if="isVideo(form.car_engine_img)">
                                    <video :src="form.car_engine_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_engine_img)">
                                    <image :src="form.car_engine_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_engine_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_engine_img')" v-if="form.car_engine_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_frame_number_img">
                            <view class="title">车架号：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_frame_number_img')">
                                <template v-if="isVideo(form.car_frame_number_img)">
                                    <video :src="form.car_frame_number_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_frame_number_img)">
                                    <image :src="form.car_frame_number_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_frame_number_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_frame_number_img')" v-if="form.car_frame_number_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_nameplate_img">
                            <view class="title">铭牌：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_nameplate_img')">
                                <template v-if="isVideo(form.car_nameplate_img)">
                                    <video :src="form.car_nameplate_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_nameplate_img)">
                                    <image :src="form.car_nameplate_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_nameplate_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_nameplate_img')" v-if="form.car_nameplate_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_central_control_img">
                            <view class="title">中控：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_central_control_img')">
                                <template v-if="isVideo(form.car_central_control_img)">
                                    <video :src="form.car_central_control_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_central_control_img)">
                                    <image :src="form.car_central_control_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_central_control_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_central_control_img')" v-if="form.car_central_control_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_steering_wheel_img">
                            <view class="title">方向盘：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_steering_wheel_img')">
                                <template v-if="isVideo(form.car_steering_wheel_img)">
                                    <video :src="form.car_steering_wheel_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_steering_wheel_img)">
                                    <image :src="form.car_steering_wheel_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_steering_wheel_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_steering_wheel_img')" v-if="form.car_steering_wheel_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_driver_seat_img">
                            <view class="title">驾驶位：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_driver_seat_img')">
                                <template v-if="isVideo(form.car_driver_seat_img)">
                                    <video :src="form.car_driver_seat_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_driver_seat_img)">
                                    <image :src="form.car_driver_seat_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_driver_seat_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_driver_seat_img')" v-if="form.car_driver_seat_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_front_seat_img">
                            <view class="title">前排座椅：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_front_seat_img')">
                                <template v-if="isVideo(form.car_front_seat_img)">
                                    <video :src="form.car_front_seat_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_front_seat_img)">
                                    <image :src="form.car_front_seat_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_front_seat_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_front_seat_img')" v-if="form.car_front_seat_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_rear_seat_img">
                            <view class="title">后排座椅：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_rear_seat_img')">
                                <template v-if="isVideo(form.car_rear_seat_img)">
                                    <video :src="form.car_rear_seat_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_rear_seat_img)">
                                    <image :src="form.car_rear_seat_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_rear_seat_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_rear_seat_img')" v-if="form.car_rear_seat_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_air_outlet_img">
                            <view class="title">出风口：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_air_outlet_img')">
                                <template v-if="isVideo(form.car_air_outlet_img)">
                                    <video :src="form.car_air_outlet_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_air_outlet_img)">
                                    <image :src="form.car_air_outlet_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_air_outlet_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_air_outlet_img')" v-if="form.car_air_outlet_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_trunk_img">
                            <view class="title">后备箱：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_trunk_img')">
                                <template v-if="isVideo(form.car_trunk_img)">
                                    <video :src="form.car_trunk_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_trunk_img)">
                                    <image :src="form.car_trunk_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_trunk_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_trunk_img')" v-if="form.car_trunk_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_spare_tire_well_img">
                            <view class="title">备胎槽：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_spare_tire_well_img')">
                                <template v-if="isVideo(form.car_spare_tire_well_img)">
                                    <video :src="form.car_spare_tire_well_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_spare_tire_well_img)">
                                    <image :src="form.car_spare_tire_well_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_spare_tire_well_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_spare_tire_well_img')" v-if="form.car_spare_tire_well_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_customer_img">
                            <view class="title">客户和车合影：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_customer_img')">
                                <template v-if="isVideo(form.car_customer_img)">
                                    <video :src="form.car_customer_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_customer_img)">
                                    <image :src="form.car_customer_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_customer_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_customer_img')" v-if="form.car_customer_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_cuseromer_manager_img">
                            <view class="title">客户经理车合影：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_cuseromer_manager_img')">
                                <template v-if="isVideo(form.car_cuseromer_manager_img)">
                                    <video :src="form.car_cuseromer_manager_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_cuseromer_manager_img)">
                                    <image :src="form.car_cuseromer_manager_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_cuseromer_manager_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_cuseromer_manager_img')" v-if="form.car_cuseromer_manager_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_skylight_img">
                            <view class="title">天窗：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_skylight_img')">
                                <template v-if="isVideo(form.car_skylight_img)">
                                    <video :src="form.car_skylight_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_skylight_img)">
                                    <image :src="form.car_skylight_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_skylight_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_skylight_img')" v-if="form.car_skylight_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_left_engine_img">
                            <view class="title">左引擎：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_left_engine_img')">
                                <template v-if="isVideo(form.car_left_engine_img)">
                                    <video :src="form.car_left_engine_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_left_engine_img)">
                                    <image :src="form.car_left_engine_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_left_engine_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_left_engine_img')" v-if="form.car_left_engine_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_right_engine_img">
                            <view class="title">右引擎：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_right_engine_img')">
                                <template v-if="isVideo(form.car_right_engine_img)">
                                    <video :src="form.car_right_engine_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_right_engine_img)">
                                    <image :src="form.car_right_engine_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_right_engine_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_right_engine_img')" v-if="form.car_right_engine_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_left_side_img">
                            <view class="title">正左侧：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_left_side_img')">
                                <template v-if="isVideo(form.car_left_side_img)">
                                    <video :src="form.car_left_side_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_left_side_img)">
                                    <image :src="form.car_left_side_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_left_side_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_left_side_img')" v-if="form.car_left_side_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                        <view class="box" v-if="checkingSupplyInfo.car_right_side_img">
                            <view class="title">正右侧：</view>
                            <view class="area column rowCenter verCenter" @click="chooseImageChange('car_right_side_img')">
                                <template v-if="isVideo(form.car_right_side_img)">
                                    <video :src="form.car_right_side_img" object-fit="cover"></video>
                                </template>
                                <template v-else-if="isImage(form.car_right_side_img)">
                                    <image :src="form.car_right_side_img" mode="aspectFill"></image>
                                </template>
                                <template v-else-if="isPdf(form.car_right_side_img)">
                                    <image class="pdf" src="@/static/pdf.png" mode="aspectFit"></image>
                                </template>
                                <view class="delete row rowCenter verCenter" @click.stop="deletePic('car_right_side_img')" v-if="form.car_right_side_img">
                                    <text class="iconfont icon-shanchu"></text>
                                </view>
                            </view>
                        </view>
                    </view>
                    <div style="margin-top: 24rpx;">
                        <view class="form-item" v-if="checkingSupplyInfo.vehicle_insurance_info_license_organ">
                            <view class="title required">保险发证机关：</view>
                            <view class="input-box row">
                                <input type="text" placeholder="请输入保险发证机关" placeholder-style="color: #6E767A;" class="uni-input" v-model="form.vehicle_insurance_info_license_organ" />
                            </view>
                        </view>
                        <view class="form-item" v-if="checkingSupplyInfo.vehicle_insurance_info_company_name">
                            <view class="title required">保险公司名称：</view>
                            <view class="input-box row">
                                <input type="text" placeholder="请输入保险公司名称" placeholder-style="color: #6E767A;" class="uni-input" v-model="form.vehicle_insurance_info_company_name" />
                            </view>
                        </view>
                        <view class="form-item" v-if="checkingSupplyInfo.vehicle_insurance_info_expiration_date">
                            <view class="title required">车辆保险信息-保险到期时间：</view>
                            <view class="dropdown row bothSide verCenter">
                                <view class="dropdown-wrap">
                                    <picker mode="date" @change="bindPickerChange($event, 1)" style="width: 100%;">
                                        <view class="picker-wrap row bothSide verCenter" style="width: 100%;">
                                            <text class="uni-text" :style="form.vehicle_insurance_info_expiration_date ? {} : { color: '#2E3233' }">{{ form.vehicle_insurance_info_expiration_date || '请选择' }}</text>
                                        </view>
                                    </picker>
                                </view>
                                <text class="dropdown-ico"></text>
                            </view>
                        </view>
                        <view class="form-item" v-if="checkingSupplyInfo.vehicle_insurance_info_certificate_no">
                            <view class="title required">车辆保险信息-权证编号：</view>
                            <view class="input-box row">
                                <input type="text" placeholder="请输入车辆保险信息-权证编号" placeholder-style="color: #6E767A;" class="uni-input" v-model="form.vehicle_insurance_info_certificate_no" />
                            </view>
                        </view>
                        <view class="form-item" v-if="checkingSupplyInfo.vehicle_insurance_info_license_date">
                            <view class="title required">车辆保险信息-发证日期：</view>
                            <view class="dropdown row bothSide verCenter">
                                <view class="dropdown-wrap">
                                    <picker mode="date" @change="bindPickerChange($event, 2)" style="width: 100%;">
                                        <view class="picker-wrap row bothSide verCenter" style="width: 100%;">
                                            <text class="uni-text" :style="form.vehicle_insurance_info_license_date ? {} : { color: '#2E3233' }">{{ form.vehicle_insurance_info_license_date || '请选择' }}</text>
                                        </view>
                                    </picker>
                                </view>
                                <text class="dropdown-ico"></text>
                            </view>
                        </view>
                    </div>
                </view>
            </view>
            <view class="btn row rowCenter verCenter" @click="submit()">保存</view>
        </section>
    </view>
</template>

<script>
import { API } from '@/util/api.js';
import { initWechatShare } from '@/util/util.js';

export default {
    data() {
        return {
            orderInfo: {},
            checkingSupplyInfo: {}, //验证只管是否配置显示
            form: {
                "order_id": "",
                "car_registration_1": "",
                "car_registration_2": "",
                "car_registration_3": "",
                "car_registration_4": "",
                "car_driver_license_1": "",
                "car_driver_license_2": "",
                "car_driver_license_3": "",
                "car_driver_license_4": "",
                "car_front_img": "",
                "car_rear_img": "",
                "car_left_front_img": "",
                "car_right_front_img": "",
                "car_left_rear_img": "",
                "car_right_rear_img": "",
                "car_engine_img": "",
                "car_frame_number_img": "",
                "car_nameplate_img": "",
                "car_central_control_img": "",
                "car_steering_wheel_img": "",
                "car_kilometers_img": "",
                "car_driver_seat_img": "",
                "car_front_seat_img": "",
                "car_rear_seat_img": "",
                "car_air_outlet_img": "",
                "car_trunk_img": "",
                "car_spare_tire_well_img": "",
                "car_customer_img": "",
                "car_cuseromer_manager_img": "",
                "car_skylight_img": "",
                "car_left_engine_img": "",
                "car_right_engine_img": "",
                "car_left_side_img": "",
                "car_right_side_img": "",
                "car_commercial_insurance_img": "",
                "car_compulsory_traffic_insurance_img": "",
                "car_violation_record_img": "",
                "car_displacement_img": "",
                "car_annual_inspection_img": "",
                "car_driving_score_img": "",
                "car_status_img": "",
                "car_elec_driver_license_img": "",
                //4.0新增字段
                "vehicle_insurance_info_expiration_date": '',
                "vehicle_insurance_info_certificate_no": '',
                "vehicle_insurance_info_license_organ": '',
                "vehicle_insurance_info_license_date": '',
                "vehicle_insurance_info_company_name": ''
            }
        };
    },
    onLoad(options) {
        this.form.order_id = options.order_id;
        this.getCheckingSupplyInfo();
    },
    methods: {
        /**
         * 获取微信分享配置并初始化
         */
        generateSignature() {
            this.request(API.generateSignature, 'GET', { url: window.location.href }, true).then(res => {
                // 调用封装的微信分享方法
                initWechatShare({
                    appId: res.appId,
                    timestamp: res.timestamp,
                    nonceStr: res.nonceStr,
                    signature: res.signature,
                    title: '车辆信息',
                    desc: '小朗优创-' + (this.orderInfo.product_name || ''),
                    link: window.location.href,
                    imgUrl: this.orderInfo.product_logo || ''
                }).then(shareData => {
                    console.log('微信分享配置成功', shareData);
                }).catch(error => {
                    console.error('微信分享配置失败', error);
                });
            });
        },
        bindPickerChange(e, type) {
            var typeMap = {
                1: { field: 'vehicle_insurance_info_expiration_date' },
                2: { field: 'vehicle_insurance_info_license_date' },
            };

            if (typeMap[type]) {
                // 处理日期选择
                this.form[typeMap[type].field] = e.detail.value;
            }
        },
        /**
         * 上传图片
         * @param {Object} elem
         */
        chooseImageChange(elem) {
            uni.chooseFile({
                count: 1, // 允许选择的文件数量，默认值为 1
                type: 'all', // 文件类型，可选值有 image、video、audio、all
                extension: ['png', 'jpg', 'jpeg', 'mp4', 'pdf'], // 允许的文件扩展名
                success: (res) => {

                    // 显示loading
                    uni.showLoading({
                        title: '上传中...'
                    });

                    // 获取选择的图片路径数组
                    const tempFilePaths = res.tempFilePaths;

                    //上传到服务器
                    uni.uploadFile({
                        url: API.uploadImage,
                        filePath: tempFilePaths[0],
                        name: 'file',
                        formData: {
                            'source': 'appUser'
                        },
                        success: uploadFileRes => {
                            console.log('服务器上传图片成功：', uploadFileRes);
                            uni.hideLoading();
                            let data = JSON.parse(uploadFileRes.data);
                            if (data.code === 0) {
                                const formMapping = {
                                    "car_registration_1": "car_registration_1",
                                    "car_registration_2": "car_registration_2",
                                    "car_registration_3": "car_registration_3",
                                    "car_registration_4": "car_registration_4",
                                    "car_driver_license_1": "car_driver_license_1",
                                    "car_driver_license_2": "car_driver_license_2",
                                    "car_driver_license_3": "car_driver_license_3",
                                    "car_driver_license_4": "car_driver_license_4",
                                    "car_commercial_insurance_img": "car_commercial_insurance_img",
                                    "car_compulsory_traffic_insurance_img": "car_compulsory_traffic_insurance_img",
                                    "car_violation_record_img": "car_violation_record_img",
                                    "car_annual_inspection_img": "car_annual_inspection_img",
                                    "car_elec_driver_license_img": "car_elec_driver_license_img",
                                    "car_status_img": "car_status_img",
                                    "car_driving_score_img": "car_driving_score_img",
                                    "car_displacement_img": "car_displacement_img",
                                    "car_front_img": "car_front_img",
                                    "car_rear_img": "car_rear_img",
                                    "car_left_front_img": "car_left_front_img",
                                    "car_right_front_img": "car_right_front_img",
                                    "car_left_rear_img": "car_left_rear_img",
                                    "car_right_rear_img": "car_right_rear_img",
                                    "car_kilometers_img": "car_kilometers_img",
                                    "car_engine_img": "car_engine_img",
                                    "car_frame_number_img": "car_frame_number_img",
                                    "car_nameplate_img": "car_nameplate_img",
                                    "car_central_control_img": "car_central_control_img",
                                    "car_steering_wheel_img": "car_steering_wheel_img",
                                    "car_driver_seat_img": "car_driver_seat_img",
                                    "car_front_seat_img": "car_front_seat_img",
                                    "car_rear_seat_img": "car_rear_seat_img",
                                    "car_air_outlet_img": "car_air_outlet_img",
                                    "car_trunk_img": "car_trunk_img",
                                    "car_spare_tire_well_img": "car_spare_tire_well_img",
                                    "car_customer_img": "car_customer_img",
                                    "car_cuseromer_manager_img": "car_cuseromer_manager_img",
                                    "car_skylight_img": "car_skylight_img",
                                    "car_left_engine_img": "car_left_engine_img",
                                    "car_right_engine_img": "car_right_engine_img",
                                    "car_left_side_img": "car_left_side_img",
                                    "car_right_side_img": "car_right_side_img",
                                    //4.0新增字段
                                    "vehicle_insurance_info_expiration_date": 'vehicle_insurance_info_expiration_date',
                                    "vehicle_insurance_info_certificate_no": 'vehicle_insurance_info_certificate_no',
                                    "vehicle_insurance_info_license_date": 'vehicle_insurance_info_license_date'
                                };
                                // 根据 elem 更新相应的表单数据
                                if (formMapping[elem]) {
                                    this.$set(this.form, formMapping[elem], data.data);
                                } else {
                                    console.warn('未识别的 elem:', elem);
                                }
                                this.$forceUpdate();
                            } else {
                                uni.showToast({
                                    title: data.msg,
                                    icon: 'none'
                                });
                            }
                        },
                        fail: () => {
                            uni.hideLoading();
                            uni.showToast({
                                title: '上传图片失败',
                                icon: 'none'
                            });
                        }
                    });
                }
            });
        },
        /**
         * 删除图片
         * @param {Object} elem
         */
        deletePic(elem) {
            const formMapping = {
                "car_registration_1": "car_registration_1",
                "car_registration_2": "car_registration_2",
                "car_registration_3": "car_registration_3",
                "car_registration_4": "car_registration_4",
                "car_driver_license_1": "car_driver_license_1",
                "car_driver_license_2": "car_driver_license_2",
                "car_driver_license_3": "car_driver_license_3",
                "car_driver_license_4": "car_driver_license_4",
                "car_commercial_insurance_img": "car_commercial_insurance_img",
                "car_compulsory_traffic_insurance_img": "car_compulsory_traffic_insurance_img",
                "car_violation_record_img": "car_violation_record_img",
                "car_annual_inspection_img": "car_annual_inspection_img",
                "car_elec_driver_license_img": "car_elec_driver_license_img",
                "car_status_img": "car_status_img",
                "car_driving_score_img": "car_driving_score_img",
                "car_displacement_img": "car_displacement_img",
                "car_front_img": "car_front_img",
                "car_rear_img": "car_rear_img",
                "car_left_front_img": "car_left_front_img",
                "car_right_front_img": "car_right_front_img",
                "car_left_rear_img": "car_left_rear_img",
                "car_right_rear_img": "car_right_rear_img",
                "car_kilometers_img": "car_kilometers_img",
                "car_engine_img": "car_engine_img",
                "car_frame_number_img": "car_frame_number_img",
                "car_nameplate_img": "car_nameplate_img",
                "car_central_control_img": "car_central_control_img",
                "car_steering_wheel_img": "car_steering_wheel_img",
                "car_driver_seat_img": "car_driver_seat_img",
                "car_front_seat_img": "car_front_seat_img",
                "car_rear_seat_img": "car_rear_seat_img",
                "car_air_outlet_img": "car_air_outlet_img",
                "car_trunk_img": "car_trunk_img",
                "car_spare_tire_well_img": "car_spare_tire_well_img",
                "car_customer_img": "car_customer_img",
                "car_cuseromer_manager_img": "car_cuseromer_manager_img",
                "car_skylight_img": "car_skylight_img",
                "car_left_engine_img": "car_left_engine_img",
                "car_right_engine_img": "car_right_engine_img",
                "car_left_side_img": "car_left_side_img",
                "car_right_side_img": "car_right_side_img",
                //4.0新增字段
                "vehicle_insurance_info_expiration_date": 'vehicle_insurance_info_expiration_date',
                "vehicle_insurance_info_certificate_no": 'vehicle_insurance_info_certificate_no',
                "vehicle_insurance_info_license_organ": 'vehicle_insurance_info_license_organ',
                "vehicle_insurance_info_license_date": 'vehicle_insurance_info_license_date',
                "vehicle_insurance_info_company_name": 'vehicle_insurance_info_company_name'
            }


            // 检查 elem 是否在映射中，并将对应的表单字段设置为空
            if (formMapping.hasOwnProperty(elem)) {
                this.$set(this.form, formMapping[elem], '');
            } else {
                console.warn('未识别的 elem:', elem);
            }
        },
        /**
         * 预览图片
         * @param {Object} img
         */
        previewChange(img) {
            uni.previewImage({
                urls: [img]
            });
        },
        /**
         * 进件字段配置信息
         */
        getCheckingSupplyInfo() {
            this.request(API.getCheckingSupplyInfo, 'GET', { order_id: this.form.order_id }, true).then(res => {
                if (res.code === 0) {
                    this.checkingSupplyInfo = res.data;
                    this.getOrderAddedInfo();
                } else {
                    // 获取信息失败的情况下，直接跳转
                    uni.redirectTo({
                        url: `/pages/order/selfDetail?order_id=${this.form.order_id}`
                    });
                }
            });
        },
        /**
         * 获取进件已经填写的资料
         */
        getOrderAddedInfo() {
            this.request(API.getOrderAddedInfo, 'GET', { order_id: this.form.order_id }, true).then(res => {
                this.orderInfo = res;
                this.generateSignature();

                // 遍历 res 对象，将除了 order_id 之外的所有字段赋值给 this.form
                Object.keys(res).forEach(key => {
                    if (key !== 'order_id' && this.form.hasOwnProperty(key)) {
                        this.$set(this.form, key, res[key]);
                    }
                });
            }).catch(error => {
                console.error('获取进件资料失败:', error);
                uni.showToast({
                    title: '获取资料失败，请重试',
                    icon: 'none'
                });
            });
        },
        /**
         * 提交
         */
        submit() {
            this.request(API.submitApproveAddCarInfo, 'POST', this.form, true).then(res => {
                if (res.code === 0) {
                    uni.showToast({
                        title: '提交成功',
                        icon: 'success',
                        duration: 2000
                    });

                    // 等待2秒后再回到上一页
                    setTimeout(() => {
                        uni.redirectTo({
                            url: "/pages/order/approveAddInfo?order_id=" + this.form.order_id
                        })
                    }, 2000);
                } else {
                    uni.showToast({
                        title: res.msg,
                        icon: 'none'
                    });
                }
            }).catch(error => {
                console.error('提交失败:', error);
                uni.showToast({
                    title: '提交失败，请重试',
                    icon: 'none'
                });
            });
        },
        /**
         * 判断文件是否为视频
         * @param {Object} file
         */
        isVideo(file) {
            return file.endsWith('.mp4') || file.endsWith('.mov') || file.endsWith('.avi'); // 可以根据需要增加其他视频格式
        },
        /**
         * 判断文件是否为图片
         * @param {Object} file
         */
        isImage(file) {
            return (
                file.endsWith('.jpg') ||
                file.endsWith('.jpeg') ||
                file.endsWith('.png') ||
                file.endsWith('.gif') ||
                file.endsWith('.bmp')
            );
        },
        /**
         * 判断文件是否为PDF
         * @param {Object} file
         */
        isPdf(file) {
            return file.endsWith('.pdf');
        }
    }
};
</script>

<style scoped lang="scss">
@import '@/assets/css/order/approveAddBaseInfo.scss';
</style>